<?php include("../config.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><?php echo $sitename; ?> - Sysop: Manage Download URLs For Custom Builds</title>
<meta name="description" content="<?php echo $sitename; ?> - Sysop: Manage Download URLs For Custom Builds">
<meta name="keywords" content="free to try, software, shareware, freeware, developers, vendors, download, PAD">
<meta name="author" content="Andrey Aleksanyants, M.D.">
<meta name="copyright" content="easy HTools">
<meta http-equiv="imagetoolbar" content="no">
<link rel="stylesheet" type="text/css" href="../<?php echo $cssfile; ?>">
<link rel="shortcut icon" href="../favicon.ico">
</head>
<body>
<table class="tmain" align="center" width="90%" cellspacing="0" cellpadding="0">
<tr>
<td class="tmain">
<table class="tlogo" align="center" width="100%" cellspacing="0" cellpadding="4">
<tr>
<td align="right">
<p><a href="index.php">Home</a></p>
</td>
</tr>
</table>
</td>
</tr><tr>
<td class="tmain">
<br>
<table align="center" width="100%" border="0" cellspacing="0" cellpadding="1">
<tr valign="top">
<td class="tbody">
<h1><?php echo $sitename; ?> - Sysop: Manage Download URLs For Custom Builds</h1>
<?php

if(!($link_id = mysql_connect($dbhost, $userid, $userpassword))) {
	die("<p><b>Error connecting to the database server:</b> " . mysql_error() . "</p>\n");
}
mysql_select_db($dbname);

$numrows = 0;
$result = mysql_query("SELECT * FROM customurls ORDER BY progid", $link_id);
if($result) $numrows = mysql_num_rows($result);
echo"<p><b>Total URLs: " . $numrows . "</b></p><br>\n";
echo "<table class=\"tvisible\" align=\"center\" cellspacing=\"0\" cellpadding=\"4\">\n";
echo "<tr>\n<td class=\"tablehead\">\n";
echo "<p><b>No</b></p>\n";
echo "</td>\n<td class=\"tablehead\">\n";
echo "<p><b>Program ID</b></p>\n";
echo "</td>\n<td class=\"tablehead\">\n";
echo "<p><b>Company</b></p>\n";
echo "</td>\n<td class=\"tablehead\">\n";
echo "<p><b>Title</b></p>\n";
echo "</td>\n<td class=\"tablehead\">\n";
echo "<p><b>Custom URL</b></p>\n";
echo "</td>\n<td class=\"tablehead\">\n";
echo "<p><b>Remove</b></p>\n";
echo "</td>\n</tr>\n";

$count = 0;
for ($i=0; $i<$numrows; $i++) {
	$count++;
	mysql_data_seek($result, $i);
	$query = mysql_fetch_array($result);
	$progid       = $query["progid"];
	$customurl    =  htmlspecialchars($query["customurl"],ENT_QUOTES);

	$result2 = mysql_query("SELECT * FROM paddata WHERE progid = '$progid'", $link_id);
	$query2 = mysql_fetch_array($result2);
	$company      = htmlspecialchars($query2["company"]);
	$website      = htmlspecialchars($query2["website"]);
	$title        = htmlspecialchars($query2["title"]);
	$homepage     = $query2["homepage"];

	// Displaying code
	echo "<tr>\n<td>\n";
	echo "<p>" . $count . "</p>\n";
	echo "</td>\n<td>\n";
	echo "<p>" . $progid . "</p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a target=\"_blank\" href=\"" . $website . "\">" . $company . "</a></p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a target=\"_blank\" href=\"" . $homepage . "\">" . $title . "</a></p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a href=\"" . $customurl . "\">Download</a></p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a href=\"customremove.php?progid=" . $progid . "\">Remove</a></p>\n";
	echo "</td>\n</tr>\n";
}
echo "</table><br>\n";

// Disconnecting from database
mysql_close($link_id);
?>
<br>

</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>